package com.visionblue.business.ship.model.api

import com.visionblue.business.ship.model.bean.request.GpsLocationRequest
import com.visionblue.business.ship.model.bean.request.PostApplicationRequest
import com.visionblue.business.ship.model.bean.response.*
import retrofit2.http.*

/**
 * @author: xlh
 * @date: 2020-04-10 2:44 PM
 * @desc:
 */
interface ServerApi {

    /**
     *   根据设备序列号获取船舶信息
     */
    @GET("devices/ship")
    suspend fun getHostShipInfo(): CommonResponse<ShipInfo>
    /**
     *   【未读通知】未读/进行中申报数量
     */
    @GET("devices/notification")
    suspend fun getTaskNotification(): CommonResponse<NotificationBean>

    /**
     *  接驳船查看污染物申报记录列表
     */
    @GET("devices/applications")
    suspend fun getApplications(
        @Query("page") page: Int,
        @Query("size") size: Int,
        @Query("status") status: Int? = null,
        @Query("statuses") statuses: String? = null
    ): CommonResponse<ListBean<ApplicationDetail>>

    /**
     * 更新申报记录状态为已读
     *
     */
    @PUT("devices/applications/{id}/view")
    suspend fun putApplicationView(@Path("id") id: String): CommonResponse<Any>

    /**
     * 接驳船接收/拒绝申报
     */
    @PUT("devices/applications/{id}")
    suspend fun putApplicationStatus(
        @Path("id") id: String,
        @Query("opCode") opCode: Int
    ): CommonResponse<Any>

    /**
     * 接收完成  重量提交
     */
    @POST("devices/applications/{id}")
    suspend fun postApplication(
        @Path("id") id: String,
        @Body request: PostApplicationRequest
    ): CommonResponse<String>

    /**
     * 污染物申报记录详情
     */
//    @GET("devices/applications/{id}")
//    suspend fun getApplicationDetail(@Path("id") applicationId: String): CommonResponse<ApplicationDetail>

    /**
     * 校验设备pin/sn码
     */
    @GET("devices/validation")
    suspend fun validateDeviceInfo(
        @Query("pin") pin: String,
        @Query("sn") sn: String
    ): CommonResponse<Any>

    /**
     * 【转运任务单列表】我发起的转运任务单
     */
    @GET("devices/applications/mine")
    suspend fun getOuterTasks(
//        @Query("status") status: Int,
        @Query("page") page: Int,
        @Query("size") size: Int
    ): CommonResponse<ListBean<ApplicationDetail>>

    /**
     * 【转运申请】接驳船发起转运申请
     */
    @POST("devices/applications/transport")
    suspend fun postTransportApplication(@Body shipNo: String): CommonResponse<Any>

    /**
     * 运输船列表
     */
    @GET("devices/ships")
    suspend fun getTransportShips(): CommonResponse<List<TransportShipInfo>>

    /**
     * 【定时上报】设备定时更新经纬度信息
     */
    @POST("devices/heartbeat")
    suspend fun postGpsLocation(@Body gpsLocationRequest: GpsLocationRequest): CommonResponse<Any>

    @DELETE("devices/applications/{id}")
    suspend fun cancelOwnApplication(@Path("id") id: String): CommonResponse<Any>


    /**
     * 获取接收联单列表
     */
    @GET("supervise/collection/list")
    suspend fun getOrdersReceive(
        @Query("page") page: Int,
        @Query("size") size: Int
    ): CommonResponse<ListBean<OrdersReceiveInfo>>

    /**
     * 获取申报单列表
     */
    @GET("supervise/complete/declare/task/list")
    suspend fun getOrdersApply(
        @Query("page") page: Int,
        @Query("size") size: Int
    ): CommonResponse<ListBean<OrdersApplyInfo>>

    /**
     * 申报单详情页
     */
    @GET("supervise/complete/declare/task/detail/{id}")
    suspend fun getApplyInfoDetail(@Path("id") id: String): CommonResponse<OrderApplyDetailsInfo>

}